// 创建一个 View 的实例，控制地图视图
var view = new ol.View({
    center: [473989.86939, 3348399.04504],
    projection: 'EPSG:3857',
    zoom: 14,
});

// 创建一个 source.TileWMS 实例，创建地图资源
var wmsSource = new ol.source.TileWMS({
  url: 'http://localhost:8080/geoserver/treemap/wms',
  params: {'LAYERS': ['boundary','compartmentline','subcompartment'], 'TILED': true},
  serverType: 'geoserver',
  crossOrigin: 'anonymous'
});

// 创建一个 layer.Tile 实例，加载地图资源
var wmsLayer = new ol.layer.Tile({
  source: wmsSource
});

// 创建一个 Map 实例，加载地图
var map = new ol.Map({
    // controls: ol.control.defaults({
    //     attribution: false,
    //     rotate: false,
    //     zoom: false
    // }),
    layers: [wmsLayer],
    target: 'map',
    view: view
});